package hankz.spring.common;

import hankz.spring.beans.BeansException;
import hankz.spring.beans.factory.ConfigurableListableBeanFactory;
import hankz.spring.beans.PropertyValue;
import hankz.spring.beans.PropertyValues;
import hankz.spring.beans.factory.config.BeanDefinition;
import hankz.spring.beans.factory.config.BeanFactoryPostProcessor;

/**
 * @description: TODO
 * @author: zzc
 * @modified By: zzc
 * @date: Created in 2021/11/21 19:01
 * @version:v1.0
 */
public class MyBeanFactoryPostProcessor implements BeanFactoryPostProcessor {

    @Override
    public void postProcessFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {

        BeanDefinition beanDefinition = beanFactory.getBeanDefinition("userService");
        PropertyValues propertyValues = beanDefinition.getPropertyValues();

        propertyValues.addPropertyValue(new PropertyValue("company", "改为：阿里巴巴"));

    }
}
